<?php

namespace Frieza\Modules\Position\Controllers;

use Encore\Admin\Grid;
use Encore\Admin\Widgets\Form;

class CarouselBannerController extends BaseController
{
    use BaseTrait;

    private $experience_type = [
        '如何花钱', '搞定需求', '找对服务',
    ];

    public function beforeLinkForm(Form $form)
    {
        switch ($this->positionId) {
            case 122:
                $form->text('base.title', '专题名称');
                $form->select('base.ext_type', '所属分类')->options($this->experience_type);
                $this->bannerFormWithCheck($form, 'base.pic_id', '封面图');
                break;
            default:
                $form->imgUpload('base.pic_id', 'banner图');
                break;
        }
    }

    public function extendList(Grid $grid)
    {
        switch ($this->positionId) {
            case 122:
                $grid->column('title', '专题名称');
                $grid->column('ext_type', '所属分类')->using($this->experience_type);
                $grid->column('pic_url', '专题封面图片')->image("", 120);
                return;
        }
    }
}
